import { REGEX_PRICE_NUMBER, REGEX_POSITIVE_INTEGER } from '@/utils/validate'

export default {
  data() {
    return {
      rules: {
        name: [
          {
            required: true,
            message: '请输入模版名称',
            trigger: ['blur', 'change']
          },
          {
            max: 50,
            message: '模板名称在50字之内',
            trigger: ['blur', 'change']
          }
        ],
        'defaultChargePo.firstValue': [
          {
            required: true,
            message: '请输入数量',
            trigger: ['blur', 'change']
          },
          {
            pattern: REGEX_POSITIVE_INTEGER,
            message: '请输入正整数',
            trigger: ['blur', 'change']
          }
        ],
        'defaultChargePo.firstCashPrice': [
          {
            required: true,
            message: '请输入金额',
            trigger: ['blur', 'change']
          },
          {
            pattern: REGEX_PRICE_NUMBER,
            message: '请输入整数，可保留两位小数',
            trigger: ['blur', 'change']
          }
        ],
        'defaultChargePo.incrementValue': [
          {
            required: true,
            message: '请输入数量',
            trigger: ['blur', 'change']
          },
          {
            pattern: REGEX_POSITIVE_INTEGER,
            message: '请输入正整数',
            trigger: ['blur', 'change']
          }
        ],
        'defaultChargePo.incrementCashPrice': [
          {
            required: true,
            message: '请输入增加金额',
            trigger: ['blur', 'change']
          },
          {
            pattern: REGEX_PRICE_NUMBER,
            message: '请输入整数，可保留两位小数',
            trigger: ['blur', 'change']
          }
        ]
      }
    }
  }
}
